const koa = require("koa");
const router = require("koa-router")();
const app = new koa();

router.get("/",async ctx=>{
    ctx.body={
        code:8080,
        res:"aliyun hello aliyun",
        msg:"你好"
    }
})

app.use(async (ctx,next)=>{
    console.log(1);
    console.log(next)
    var res = await next()
    console.log(res)    //hello
    console.log(3)
})
app.use(async ctx=>{
    console.log(2)
    return "hello"
})

app.use(router.routes())
app.listen(5050)